

package com.casic.exception;

import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import lombok.extern.slf4j.Slf4j;

/**
 * 异常处理器
 *
 * @author 朵朵
 */
@Slf4j
@ControllerAdvice
public class AOPExceptionHandler{

	/**
	 * 处理自定义异常
	 */
	@ExceptionHandler(AopException.class)
	public void handleRRException(AopException e){
		log.error(e.getMessage(), e);
	}

	@ExceptionHandler(DuplicateKeyException.class)
	public void handleDuplicateKeyException(DuplicateKeyException e){
		log.error(e.getMessage(), e);
	}

	@ExceptionHandler(Exception.class)
	public void handleException(Exception e){
		log.error(e.getMessage(), e);
	}
}
